package one.stand.controller;

import one.stand.model.ResultModel;
import one.stand.request.BusinessCardRequest;
import one.stand.response.BusinessCardResponse;
import one.stand.response.GetCompanyStaffResponse;
import one.stand.service.CardFacadeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 企业成员
 *
 * @author Administrator
 */
@RestController
@RequestMapping("businessCard")
public class BusinessCardController extends BaseController {

    @Autowired
    private CardFacadeService cardFacadeService;

    /**
     * crm端查询名片列表
     *
     * @param request
     * @return
     */
    @PostMapping("selectBusinessCardList")
    public ResultModel<List<BusinessCardResponse>> selectBusinessCardList(@RequestBody BusinessCardRequest request) {
        return businessCardService.selectBusinessCardList(request);
    }

    /**
     * 修改用户名片欢迎语
     *
     * @param request
     * @return
     */
    @PostMapping("updateCardWelcomeSpeech")
    public ResultModel<Boolean> updateCardWelcomeSpeech(@RequestBody BusinessCardRequest request) {
        return businessCardService.updateCardWelcomeSpeech(request);
    }

    /**
     * 获取公司员工
     *
     * @param request
     * @return
     */
    @PostMapping("getCompanyStaffList")
    public ResultModel<Map<String, Object>> getCompanyStaffList(@RequestBody BusinessCardRequest request) {
        return businessCardService.getCompanyStaffList(request);
    }

    /**
     * 得到公司员工信息
     *
     * @param request
     * @return
     */
    @PostMapping("getCompanyStaffInfo")
    public ResultModel<GetCompanyStaffResponse> getCompanyStaffInfo(@RequestBody BusinessCardRequest request) {
        return businessCardService.getCompanyStaffInfo(request);
    }

    /**
     * 得到名片海报
     */
    @PostMapping("getCardPoster")
    public ResultModel getCardPoster(@RequestBody BusinessCardRequest request) {
        return cardFacadeService.getCardPoster(request);
    }
}
